package com.mexico.inloancash.activity;


import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.mexico.inloancash.R;
import com.mexico.inloancash.utils.MyPreferencesManager;
import com.mexico.inloancash.utils.Utils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class IndiaCommon_SettingActivity extends BaseActivity {

    @BindView(R.id.logon_back)
    ImageView gonBack;

    @BindView(R.id.title)
    TextView title;

    @BindView(R.id.version)
    TextView mIndia_Version;

    @BindView(R.id.logout)
    Button mIndiaButton_Logout;

    @BindView(R.id.set_email)
    TextView mIndiaTv_Email;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.india_activity_set_view_layout);
        ButterKnife.bind(this);
        title.setText("Setting");
        mIndia_Version.setText("v" + Utils.getVersionName(this));
        mIndiaTv_Email.setText(MyPreferencesManager.getString("email",""));
    }

    @OnClick({R.id.logon_back, R.id.logout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.logon_back:
                finish();
                break;
            case R.id.logout:
                MyPreferencesManager.putString("token", "");
                MyPreferencesManager.putLogin(false);
                MainActivity.isShow=false;
                Intent intent = new Intent(this, IndiaLoginActivity.class);
                startActivity(intent);
                finish();
                break;
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
        }
        return super.onKeyDown(keyCode, event);
    }
}
